<template>
  <div>
    这是father.vue
    <my-son></my-son>
  </div>
</template>

<script>
import MySon from './MySon.vue'
export default {
  components: {
    MySon
  },
  data() {
    return {
        timerId: null
    }
  },
  created () {
    // 定时器是属于window的，你销毁的只是father这个组件
    // 跟window没有半毛钱关系
    this.timerId = setInterval(() => {
        console.log('.....')
    }, 1000);
  },
  beforeDestroy () {
    console.log('father-beforeDestroy')

  },

  destroyed () {
    console.log('father-destroyed')
    clearInterval(this.timerId)
  }
}
</script>

<style></style>
